<template>
  <div class="root">
    <div class="container">
      <div class="title-bar">
        <h2 class="title">{{ this.$route.params.game_name }}</h2>
        <div class="btn-group">
          <div class="btn" @click="fullScreen">全屏</div>
        </div>
        
      </div>
      
      <div class="box">
        <iframe charset="utf-8" scrolling="no" class="screen" :src="iframeUrl"></iframe>
      </div>
    </div>
    
  </div>
</template>

<script>
export default {
  data() {
    return {
      // gameUrl: '/game-server/adarkroom/index.html',
      // gameUrl: 'http://49.234.184.37:12123/adarkroom/index.html',
      iframeUrl: ''
    }
  },
  created() {
    this.getGameUrl()
  },
  methods: {
    getGameUrl() {
      this.iframeUrl = `http://49.234.184.37:12123/${this.$route.params.game_name}/index.html`
    },
    fullScreen() {
      location.href = this.iframeUrl;
    }
  }
}
</script>

<style lang="less" scoped>
.root {
  min-height: calc(100vh - 3rem - 1px);
  background: #f5f6f7;
  display: flex;
  .container {
    // max-width: 768px;
    margin: 0 auto;
    .title-bar {
      display: flex;
      align-items: center;
      .btn-group {
        display: flex;
        align-items: center;
        margin-left: auto;
        .btn {
          user-select: none;
          cursor: pointer;
          padding: 0.2rem 1rem;
          background-color: black;
          border-radius: 3px;
          color: white;
        }
      }
    }
    .box {
      
      background: white;
      .screen {
        height: 600px;
        width: 1000px;
        border: none;
      }
    }
  }
}
</style>